<template>
  <div>
    <el-form ref="form" :model="user" label-width="80px">

      <el-form-item label="账号">
        <el-input v-model="user.account" placeholder=" 示例：1900301310"/>
      </el-form-item>

      <el-form-item label="密码">
        <el-input v-model="user.password" type="password" placeholder=" 示例：1900301310"/>
      </el-form-item>

      <el-form-item label="邮箱">
        <el-input v-model="user.mail" placeholder=" 示例：123@qq.com"/>
      </el-form-item>

      <el-form-item label="电话">
        <el-input v-model="user.phone" placeholder=" 示例：1900301310"/>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="saveInfo">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import userClient from "~/api/userClient";
export default {
  data(){
    return{
      user:{
        id:'',
        account:'',
        name:'',
        password:'',
        mail:'',
        phone:'',
        reserveNumber:'',
        reserveNumberCancel:'',
        state:'',
        isDeleted:'',
        gmtCreate:'',
        gmtModified:''
      },
    }
  },
  created() {
    this.getUserInfo()
  },
  methods:{
    getUserInfo(){
      userClient.getUserInfo()
      .then(response=>{
        this.user = response.data.data.user
      })
    },
    saveInfo() {
      userClient.updateUserInfo(this.user)
        .then(response => {
          this.$message({
            type: 'success',
            message: '修改成功!'
          });
        })
    },
  },

}

</script>
